﻿Public Class clsInhPozycjeWysylki

    Public Function SprawdzPozycjeWysylki(ByVal lvarDbHolder As clsDataBase, ByRef ErrorHandler As clsErrorHandler, ByVal Zapytanie As Integer) As Integer

        Dim lvarWynik As Integer = -1

        Dim lvarReader As OdbcDataReader = Nothing
        If lvarDbHolder.IsOpen Then
            Dim lvarSqlRunner As New clsSqlRunner(lvarDbHolder, "queries_application_oem", "cls_pozycje_wysylki", 1, VAR_ERROR_HANDLER)
            'SELECT id FROM oem.pozycje_wysylki WHERE pozycje_zlecenia_id = <%p_zapytanie%>;

            With lvarSqlRunner
                .AddParameter("p_zapytanie", CStr(Zapytanie))
                lvarReader = .ExecuteQuery
            End With
            If lvarReader.HasRows Then
                While lvarReader.Read
                    lvarWynik = CInt(IIf(IsDBNull(lvarReader.Item("id")), -1, lvarReader.Item("id")))
                End While

            End If
        End If

        Return lvarWynik

    End Function

End Class
